<%@ taglib uri="http://java.sun.com/jsp/jstl/core" 				prefix="c" %>
<%@ taglib uri="http://displaytag.sf.net" 						prefix="display" %>
<%@ taglib uri="/struts-tags" 									prefix="s"%>

<link type="text/css" rel="stylesheet" href="js/jquery/css/ui-lightness/jquery-ui-1.8.16.custom.css"/>
<script type="text/javascript" src="js/jquery/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="js/jquery/jquery-ui-1.8.16.custom.min.js"></script>
<link rel="stylesheet" type="text/css" href="styles/form-input.css" />
<link rel="stylesheet" type="text/css" href="styles/displaytag.css" />
<script type="text/javascript">
	$(function() {
		var dates = $( "#fromDate, #toDate" ).datepicker({
			dateFormat: 'd MM, yy',
			showAnim: 'slide', 
			changeMonth: true,
			changeYear: true,
			numberOfMonths: 1,
			yearRange: '1958:2020',
			onSelect: function( selectedDate ) {
				var option = this.id == "fromDate" ? "minDate" : "maxDate",
					instance = $( this ).data( "datepicker" ),
						date = $.datepicker.parseDate( instance.settings.dateFormat || $.datepicker._defaults.dateFormat,
							selectedDate, instance.settings );
				dates.not( this ).datepicker( "option", option, date );
			}
		});
	});
	$(document).ready(function() {
		$("button").button();
	});
	
	function CheckAll(fmobj) {
		for (var i=0;i<fmobj.elements.length;i++) {
			var e = fmobj.elements[i];
			if ((e.name != 'allbox') && (e.type=='checkbox') && (!e.disabled)) {
				e.checked = fmobj.allbox.checked;
			}
		}
	};
</script>

	<div class="error-text"><s:actionerror /></div>
	<div class="error-text"><s:fielderror /></div>
	<div class="message-text"><s:actionmessage /></div>
	
	<div>
		<s:form theme="simple" validate="false" method="POST" >
			<fieldset style="width:800px">
            	<legend><h3 style="color: #76879b">Cari Data</h3></legend>
           		<table cellpadding="3" class="table-form">
					<tr><td>Kata kunci</td><td><s:textfield name="keyword" size="30" maxLength="30"/></td></tr>
					<tr><td>Kantor Cabang</td><td><s:select name="branchCode" list="branchList" listKey="theKey" listValue="theValue" headerKey="-1" headerValue="Search by kantor cabang"/></tr>
					<tr><td>Jenis Rekening</td><td><s:select name="accCode" list="accTypeMap" headerKey="-1" headerValue="All Account Type"/></tr>					
					<tr><td>Dari*</td><td width="200px"><s:textfield name="fromDate" id="fromDate" readonly="true"/></td><td>sampai</td><td><s:textfield name="toDate" id="toDate" readonly="true"/></td></tr>
					<tr></tr>
					<tr><td></td><td>
		            <s:submit type="button" action="searchReceiving">search</s:submit>
		            <button type="reset">reset</button>
	            </table>
			</fieldset>			
		</s:form>
	</div>
	
	<div>
		<h5 class="form-header" align="right"><s:property value="model.branchName"/></h5>
		<s:form name="form_table" method="POST" action="setReceived" theme="simple" onsubmit="return confirm('Are you sure you have the following documents is acceptable?');">
			<c:set var="checkAll">
    			<input type="checkbox" name="allbox" onclick="CheckAll(document.form_table)" />
			</c:set>
			<display:table 	id			= "mm"
	              			name       	= "${model.master2Models}"
	             			pagesize   	= "15" style="width:800px"
	              			requestURI 	= "/receiving-docs" 
	              			class		= "display"
	              			decorator	= "com.btpn.custody.web.m007.decorator.ReceivingDecorator">
	              	
	            <%--<display:caption class="form-header">Checklist Table</display:caption>--%>
	              	
	            <display:column title	= "${checkAll}"
	            				property= "checkbox" style="width: 5%" />
	        
	   			<display:column title	= "NO."
	              				value   = "${mm_rowNum}" style="width: 5%" />
	              				   
			   	<display:column title 	= "Nomor Rekening"
			   					value	= "${mm.account}" 
			   					sortable= "true" />
			   	
			   	<display:column title 	= "Nama Nasabah"
			   					value	= "${mm.cstName}" 
			   					sortable= "true" />
			   	
			   	<display:column title 	= "Jenis Rekening"
			   					value	= "${mm.accType}" 
			   					sortable= "true"/>
			   	
			   	<%--<display:column title 	= "Casa"
			   					value	= "${mm.rekType}" 
			   					sortable= "true" /> --%>
			   					
			   	<display:column title 	= "Account Open"
			   					value	= "${mm.accOpen}" 
			   					sortable= "true" />
			  
			</display:table>
			<c:if test="${model.master2Models.size()>0}" >
	    		<button type="submit" value="received">Received</button>
        	</c:if>
		</s:form>
	</div>